/**
 *    Copyright (C) 2008, 2009  Victor Smirnov <aist11@gmail.com>
 *
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License along
 *    with this program; if not, write to the Free Software Foundation, Inc.,
 *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 *    See LICENSE.exceptions in the root folder of this project for possible
 *    exceptions
 *
 */

#ifndef _CUBEFS_API_REFLECTION_ARRAY_HPP
#define	_CUBEFS_API_REFLECTION_ARRAY_HPP

#include <cubefs/api/reflection/list.hpp>

namespace cubefs    {
namespace api       {

template <typename T>
struct CUBEFS_API Array: public List {
	virtual void* ptr() 															= 0;
	virtual const void* ptr() const 												= 0;

	virtual const T& GetValue(Int idx) const 										= 0;
	virtual void SetValue(Int idx, const T& value)									= 0;

	virtual void Resize(Int size)													= 0;

	virtual const void* Addr(Int idx) const 										= 0;
	virtual void* Addr(Int idx) 													= 0;

	virtual void Insert(Int idx, const T& value)									= 0;
	virtual void Insert(Int idx, const Array<T>* values, Int start, Int length) 	= 0;
	virtual void Remove(Int start, Int length)										= 0;

    static Type* MyType() {
    	return GetArrayType(TypeHash<T>::hash);
    }
};

typedef Array<Byte> ByteArray;

CUBEFS_API Type* GetArrayType(Int type_hash_code);

CUBEFS_DECLARE_PARAMETRIZED_TYPENAME(Array, "cubefs::api::Array");

}
}



#endif
